
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="Bookmark" href="/favicon.ico">
    <link rel="Shortcut Icon" href="/favicon.ico"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5shiv.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title></title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 系统设置 <span
        class="c-gray en">&gt;</span> 系统角色 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
                                              href="javascript: is_search=''; ii_page = 1; $('#inputSearch').val('');  f_getinfo(); "
                                              title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
            <a href="javascript:" onclick="f_excel()" class="btn btn-primary radius">
                <i class="Hui-iconfont">&#xe600;</i> 数据导出</a>
        </span>
        <span class="r" style="padding-top: 6px;">共有数据：[<strong id="count">${list2[0].value01}</strong> 条]</span>
    </div>
    <table style="table-layout:fixed; width: 100%; word-break:break-all;" class="table table-border table-bordered table-bg table-hover table-sort table-responsive" id="tablelist">
        <span class="l" style="padding-top: 6px;">角色列表</span>
        <thead>
        <tr class="text-c" style="height:0;">
            <th style="width: 40px">编号</th>
            <th style="width: 200px">角色名称</th>
            <th style="width: 40px">状态</th>
            <th style="width: 40px">操作</th>
        </tr>
        </thead>
        <tbody id="datalist">
        </tbody>
    </table>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/jquery-3.2.1.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="lib/layui_exts/excel.js"></script>
<script type="text/javascript">

    $(document).ajaxComplete(function (event, xhr, settings) {
        //从http头信息取出 在filter定义的sessionstatus，判断是否是 timeout
        if (xhr.getResponseHeader("sessionstatus") === "timeout") {
            //从http头信息取出登录的url ＝ loginPath
            if (xhr.getResponseHeader("loginPath")) {
                window.location.replace(xhr.getResponseHeader("loginPath"));
            }
        }
    });

    $(document).ready(function () {
        f_getinfo();
    });

    function f_getinfo() {
        $.ajax({
            type: 'post',
            url: 'com',
            data: {
                URL: '',
                CMD: 'ZC'
            },
            async: false,
            success: function (data) {
                var jsonobj = JSON.parse(data);

                ii_count = jsonobj.db2[0].VALUE01;
                $("#count").text(ii_count);

                var c_table = $("#datalist");
                c_table.html("");
                var str = "";
                var json1 = jsonobj.db1;
                for (var key in json1) {
                    let tip = json1[key].VALUE03.toString();

                    str += "<tr class='text-c'>" +
                        "<td>" + json1[key].VALUE01.toString() + "</td>" +
                        "<td>" + json1[key].VALUE02.toString() + "</td>" +
                        "<td class='td-status'><span class='label label-success radius'>" + tip + "</span></td>" +
                        "<td class='td-manage'>" +
                        "    <a title=\"权限设定\" onclick=\"f_right('权限设定',this,'800','500')\" class='ml-5' style='text-decoration:none'><i class='Hui-iconfont'>&#xe63c;</i></a>" +
                        "</td>" +
                        "</tr>";

                }
                c_table.html(str);
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                layer.msg('网络异常错误', {icon: 1, time: 1000});
            }
        })
    }

    /*权限*/
    function f_right(title, obj, w, h) {
        if (title == null || title === '') {
            title = false;
        }

        if (w == null || w === '') {
            w = 800;
        }

        if (h == null || h === '') {
            h = ($(window).height() - 50);
        }

        layer.open({
            type: 2,
            area: [w + 'px', h + 'px'],
            fix: false, //不固定
            maxmin: false,
            shade: 0.4,
            title: title,
            content: 'right?URL=w_right.jsp&CMD=ZD&VALUE01=' + $(obj).parent().parent().find('td').eq(0).text(),
            end: function () {
                location.replace(location.href);
            }
        });
    }

    //////////////////////////////////////////////////////////////////////////
    function f_excel(){
        var data = LAY_EXCEL.tableToJson(document.getElementById('tablelist')) // 或者 $('#LAY-EXPORT-TEST')
        var exportData = []
        exportData.push.apply(exportData, data.head)
        exportData.push.apply(exportData, data.body)

        LAY_EXCEL.exportExcel(exportData, '系统角色.xlsx', 'xlsx')
    }


</script>
</body>
</html>
